<?php
    ini_set('display_errors', 'On');
    error_reporting(E_ALL);
    if (file_exists('1.html')) {
        $data = file_get_contents('1.html');
    } else {
        $data = file_get_contents('http://m.anyew.cn/chapter/10204/1.html');
        file_put_contents('1.html', $data);
    }

    $pre = new DomDocument();
    @$pre->loadHTML($data);
    $data = $pre->documentElement;
    $count = $data->getElementsByTagName('input')->length;
    $list = [];

    $title = $data->getElementsByTagName('title')->item(0)->nodeValue;
    for ($i = 0; $i < $count; $i ++) {
        $temp = $data->getElementsByTagName('input')->item($i);
        $class = $temp->getAttributeNode('class')->value;
        if (strpos($class, 'data-trd') !== false) {
            $list[$class] = $temp->getAttributeNode('value')->value;
        }
    }

    $list['data-trdkk'] = explode('.', ltrim($list['data-trdkk'], 's='));

?>

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title><?php echo $title;?></title>
    <script src="https://cdn.bootcss.com/jquery/3.3.1/jquery.min.js"></script>
    <script src='1.js'></script>

    <script>
    l = trd.lib.CipherParams.create({
		ciphertext: trd.enc.Base64.parse('<?php echo $list['data-trda']; ?>')
	}), m = trd.ALGON.decrypt(l, trd.enc.Hex.parse('<?php echo $list['data-trdkk'][0]; ?>' || ""), {
		iv: trd.enc.Hex.parse('<?php echo $list['data-trdkk'][1]; ?>' || "")
    })
    
    document.body.innerHTML = '<h1><?php echo $title;?></h1><br>' + m.toString(trd.enc.Utf8);
</script>
</head>
<body>
    
</body>
</html>

